﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoriPeter.FitnessJournal8.DAL
{
    public static class DateTimeExtension
    {
        public static bool DayEqual(this DateTime _date1, DateTime _date2)
        {
            bool equal = true;

            if (_date1.Year != _date2.Year)
                equal = false;

            if (_date1.Month != _date2.Month)
                equal = false;

            if (_date1.Day != _date2.Day)
                equal = false;

            return equal;
        }

        public static DateTime FirstDayOfMonth(this DateTime _date)
        {
            var date = new DateTime(_date.Year, _date.Month, 1);

            return date;
        }

        public static DateTime LastDayOfMonth(this DateTime _date)
        {
            var date = new DateTime(_date.Year, _date.Month, DateTime.DaysInMonth(_date.Year, _date.Month));

            return date;
        }
    }
}
